package com.heima.article.feign;

import com.heima.article.service.ApArticleService;
import com.heima.feign.article.IApArticleClient;
import com.heima.model.common.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Lijx
 * @Date 2024-07-23 17:43
 */
@RestController
@Slf4j
public class ArticleClient implements IApArticleClient {

    @Autowired
    private ApArticleService articleService;

    /**
     * 保存或者修改文章信息
     * @param articleDto
     * @return
     */
    @Override
    @PostMapping("/api/v1/article/sync")
    public ResponseResult saveOrUpdate(ArticleDto articleDto) {
        log.info("feign远程调用保存或者修改文章信息接口，入参={}",articleDto);
        return articleService.saveOrUpdateArticle(articleDto);
    }
}
